<template>
  <navbarback></navbarback>
  <view class="Sta">
      <view class="list-container">
        <scroll-view class="Sta-list" scroll-y :show-scrollbar="false">
          <view class="Sta-item" v-for="(StaItem, index) in StaV" :key="index">
            <view class="Sta-text">
              <text>姓名：{{ StaItem.name }}</text>
            </view>
            <view class="Sta-text">
              <text>性别：{{ StaItem.sex }}</text>
            </view>
            <view class="Sta-text">
              <text>年龄：{{ StaItem.age }}岁</text>
            </view>
            <view class="Sta-text">
              <text>联系电话：{{ StaItem.phoneNumber }}</text>
            </view>
            <view class="Sta-text">
              <text>建档日期：{{ StaItem.createTime }}</text>
            </view>
          </view>
        </scroll-view>
      </view>

  </view>
</template>

<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { computed } from 'vue'
import { onLoad, onShow, onTabItemTap } from '@dcloudio/uni-app'
import { http } from '@/utils/http'
import navbarback from '@/component/navbarback2.vue'
const StaV = ref([]);
const getStaList = (diseaseName) => {

  http({
    url:
      `/patient/selectArchiveDetail?diseaseName=${diseaseName}&page=1&pageSize=10`,
    method: 'GET',
  }).then(function(response: any) {
       StaV.value = response.data.archiveList.list.map(item => ({
              name: item.name,
              sex: item.sex,
              age: item.age,
              phoneNumber: item.phoneNumber,
              createTime: item.createTime.replace('T', ' ')
            }));
      //console.log(response)
  });

};


onLoad((options) => {
  const diseaseName = decodeURIComponent(options.crowdName);
  getStaList(diseaseName);
})

</script>

<style scoped lang="scss">
.Sta {
  padding: 5rpx 5rpx 0 5rpx;
  position: relative;
  background-color: #f0f0f0;
}
  .list-container {
    width: 100%;
    height: calc(85vh + 5rpx);
    margin-top: 2rpx;
    overflow-y: auto;
      //列表
      .Sta-list{
        width: 100%;
        .Sta-item {
          display: flex;
          justify-content: flex-start;
          align-items: center;
          background-color: #fff;
          position: relative;
          overflow: hidden;
          height: 50rpx;
          padding-left: 50rpx;
          padding-right: 10rpx;
          margin-bottom: 4rpx;
        }

        .Sta-text {
          font-size: 16px;
          flex-grow: 1;
        }

      }
  }

</style>
